home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 15.1 KB | 514 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: PRSIGlue.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef PRSIGLUE_H
- #include "PRSIGlue.h"
- #endif
-
- #ifndef PRSLGLTY_H
- #include "PRSIGlTy.h"
- #endif
-
- #ifndef FWDEBUG_H
- #include "FWDebug.h"
- #endif
-
- #ifndef FWSEMINT_H
- #include "FWSemInt.h"
- #endif
-
- #ifndef FWAPLEVT_H
- #include "FWAplEvt.h"
- #endif
-
- #ifdef FW_DEBUG
- #define FW_kSIInvalidException "Your mother temporarily wears army boots"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_Errors_defined
- #include <ErrorDef.xh>
- #endif
-
- //========================================================================================
- // Runtime Informations
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwsemevt
- #endif
-
- //========================================================================================
- // SOM -> C++ Glue Declarations
- //========================================================================================
-
- FW_EXTERN_C_BEGIN
-
- static FW_PlatformError FW_PrivCallEventHandlerGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODAppleEvent* theODAppleEvent, ODAppleEvent* reply);
-
- static FW_PlatformError FW_PrivCallCoercionHandlerGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODDesc* theODDesc, ODDescType toType,
- ODDesc* theResult);
-
- static FW_PlatformError FW_PrivCallPredispatchProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODAppleEvent* theODAppleEvent, ODAppleEvent* reply);
-
- static FW_PlatformError FW_PrivCallObjectAccessorGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODDescType desiredClass, ODOSLToken* container,
- ODDescType containerClass, ODDescType form,
- ODDesc* selectionData, ODOSLToken* value);
-
- static FW_PlatformError FW_PrivCallCompareProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODDescType oper, ODOSLToken* obj1,
- ODOSLToken* obj2, ODBoolean* result);
-
- static FW_PlatformError FW_PrivCallCountProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODDescType desiredType, ODDescType containerClass,
- ODOSLToken* container, ODSLong* result);
-
- static FW_PlatformError FW_PrivCallDisposeTokenProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODOSLToken* unneededToken);
-
- static FW_PlatformError FW_PrivCallGetErrDescProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODDesc** errDesc);
-
- static FW_PlatformError FW_PrivCallGetMarkTokenProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODOSLToken* dContainerToken, ODDescType containerClass,
- ODOSLToken* result);
-
- static FW_PlatformError FW_PrivCallMarkProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODOSLToken* dToken, ODOSLToken* markToken,
- ODSLong index);
-
- static FW_PlatformError FW_PrivCallAdjustMarksProcGlue(Environment* ev, FW_CSemanticInterface* semInt,
- ODSLong newStart, ODSLong newStop, ODOSLToken* markToken);
-
- FW_EXTERN_C_END
-
- //========================================================================================
- // Static Definitions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // Routine Descriptors
- //----------------------------------------------------------------------------------------
-
- static RoutineDescriptor priv_rdCallEventHandler = FW_RoutDesc_CallEventHandler(FW_PrivCallEventHandlerGlue);
- static RoutineDescriptor priv_rdCallCoercionHandler = FW_RoutDesc_CallCoercionHandler(FW_PrivCallCoercionHandlerGlue);
- static RoutineDescriptor priv_rdCallPredispatchProc = FW_RoutDesc_CallPredispatchProc(FW_PrivCallPredispatchProcGlue);
- static RoutineDescriptor priv_rdCallObjectAccessorProc = FW_RoutDesc_CallObjectAccessorProc(FW_PrivCallObjectAccessorGlue);
- static RoutineDescriptor priv_rdCallCompareProc = FW_RoutDesc_CallCompareProc(FW_PrivCallCompareProcGlue);
- static RoutineDescriptor priv_rdCallCountProc = FW_RoutDesc_CallCountProc(FW_PrivCallCountProcGlue);
- static RoutineDescriptor priv_rdCallDisposeTokenProc = FW_RoutDesc_CallDisposeTokenProc(FW_PrivCallDisposeTokenProcGlue);
- static RoutineDescriptor priv_rdCallGetErrDescProc = FW_RoutDesc_CallGetErrDescProc(FW_PrivCallGetErrDescProcGlue);
- static RoutineDescriptor priv_rdCallGetMarkTokenProc = FW_RoutDesc_CallGetMarkTokenProc(FW_PrivCallGetMarkTokenProcGlue);
- static RoutineDescriptor priv_rdCallMarkProc = FW_RoutDesc_CallMarkProc(FW_PrivCallMarkProcGlue);
- static RoutineDescriptor priv_rdCallAdjustMarksProc = FW_RoutDesc_CallAdjustMarksProc(FW_PrivCallAdjustMarksProcGlue);
-
- //----------------------------------------------------------------------------------------
- // Callback Pointer Block
- //----------------------------------------------------------------------------------------
-
- static FW_SSemIntGlueProcs privSemanticInterfaceGlueProcs = {
- &priv_rdCallEventHandler, &priv_rdCallCoercionHandler, &priv_rdCallPredispatchProc,
- &priv_rdCallObjectAccessorProc, &priv_rdCallCompareProc, &priv_rdCallCountProc,
- &priv_rdCallDisposeTokenProc, &priv_rdCallGetErrDescProc, &priv_rdCallGetMarkTokenProc,
- &priv_rdCallMarkProc, &priv_rdCallAdjustMarksProc };
-
- //========================================================================================
- // Exported Functions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_PrivGetSemanticInterfaceGlue
- //----------------------------------------------------------------------------------------
-
- FW_SSemIntGlueProcs* FW_PrivGetSemanticInterfaceGlue()
- {
- return &privSemanticInterfaceGlueProcs;
- }
-
- //========================================================================================
- // Private SOM -> C++ Glue
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallEventHandlerGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallEventHandlerGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODAppleEvent* theODAppleEvent,
- ODAppleEvent* reply)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- FW_CAppleEvent localEvent(theODAppleEvent);
- FW_CAppleEvent localReply(reply);
-
- semInt->CallEventHandler(ev, localEvent, localReply);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallCoercionHandlerGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallCoercionHandlerGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODDesc* theODDesc,
- ODDescType toType,
- ODDesc* theResult)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- FW_CDesc localDesc(theODDesc);
- FW_CDesc localResultDesc(theResult);
-
- semInt->CallCoercionHandler(ev, localDesc, toType, localResultDesc);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallPredispatchProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallPredispatchProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODAppleEvent* theODAppleEvent,
- ODAppleEvent* reply)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- FW_CAppleEvent localEvent(theODAppleEvent);
- FW_CAppleEvent localReply(reply);
-
- semInt->CallPredispatchProc(ev, localEvent, localReply);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallObjectAccessorGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallObjectAccessorGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODDescType desiredClass,
- ODOSLToken* container,
- ODDescType containerClass,
- ODDescType form,
- ODDesc* selectionData,
- ODOSLToken* value)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- FW_CDesc localSelectionData(selectionData);
- semInt->CallObjectAccessor(ev, desiredClass, container, containerClass, form, localSelectionData, value);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallCompareProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallCompareProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODDescType oper,
- ODOSLToken* obj1,
- ODOSLToken* obj2,
- ODBoolean* result)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallCompareProc(ev, oper, obj1, obj2, result);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallCountProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallCountProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODDescType desiredType,
- ODDescType containerClass,
- ODOSLToken* container,
- ODSLong* result)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallCountProc(ev, desiredType, containerClass, container, result);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallDisposeTokenProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallDisposeTokenProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODOSLToken* unneededToken)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallDisposeTokenProc(ev, unneededToken);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallGetErrDescProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallGetErrDescProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODDesc** errDesc)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallGetErrDescProc(ev, errDesc);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallGetMarkTokenProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallGetMarkTokenProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODOSLToken* dContainerToken,
- ODDescType containerClass,
- ODOSLToken* result)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallGetMarkTokenProc(ev, dContainerToken, containerClass, result);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallMarkProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallMarkProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODOSLToken* dToken,
- ODOSLToken* markToken,
- ODSLong index)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallMarkProc(ev, dToken, markToken, index);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivCallAdjustMarksProcGlue
- //----------------------------------------------------------------------------------------
-
- static FW_PlatformError FW_PrivCallAdjustMarksProcGlue(Environment* ev,
- FW_CSemanticInterface* semInt,
- ODSLong newStart,
- ODSLong newStop,
- ODOSLToken* markToken)
- {
- FW_PlatformError error = FW_xNoError;
-
- FW_TRY
- {
- semInt->CallAdjustMarksProc(ev, newStart, newStop, markToken);
- }
- FW_CATCH_BEGIN
- FW_CATCH_REFERENCE(FW_XException, exception)
- {
- error = exception.GetPlatformError();
- }
- #ifdef FW_DEBUG
- FW_CATCH_EVERYTHING()
- {
- FW_DEBUG_MESSAGE(FW_kSIInvalidException);
- error = kODErrUndefined;
- }
- #endif
- FW_CATCH_END
-
- return error;
- }
-